/*
 * 
 * LegendShop 多用户商城系统
 * 
 *  版权所有,并保留所有权利。
 * 
 */
package com.legendshop.oa.service;

import java.util.List;

import com.alibaba.fastjson.JSONObject;
import com.legendshop.dao.support.PageSupport;
import com.legendshop.oa.dto.ProjectQueryDto;
import com.legendshop.oa.dto.ProjectReport;
import com.legendshop.oa.dto.ProjectReportQueryDto;
import com.legendshop.oa.model.KeyValueEntity;
import com.legendshop.oa.model.Project;
import com.legendshop.oa.security.UserDetail;

/**
 * The Class ProjectService. 服务接口
 */
public interface ProjectService {

	/**
	 * 根据商城获取列表
	 */
	public List<Project> getProject(String userName);

	/**
	 * 根据Id获取
	 */
	public Project getProject(UserDetail userDetail, Long id);
	

	/**
	 * 获取项目的同事加载项目模块
	 * @param projectId
	 * @return
	 */
	public Project getProjectWithModule(Long projectId);

	/**
	 * 删除
	 */
	public void deleteProject(UserDetail userDetail, Project project);

	/**
	 * 保存
	 */
	public Long saveProject(Project project,UserDetail ud);

	/**
	 * 更新
	 */
	public void updateProject(Project project);

	/**
	 * 获取项目列表
	 *
	 */
	public PageSupport<Project> getProject(ProjectQueryDto projectQueryDto);

	public List<KeyValueEntity> loadProjectsEntity(UserDetail userDetail);

	public List<KeyValueEntity> loadModulesEntity(Integer projectId);

	/**
	 * 项目是否可以访问
	 * @param project
	 * @param userDetail
	 * @return
	 */
	public boolean isProjectAccessable(Project project,UserDetail userDetail);
	
	/**
	 * 项目是否可写
	 * @param project
	 * @param userDetail
	 * @return
	 */
	public boolean isProjectWritable(Project project, UserDetail userDetail);
	
	/**
	 * 项目是否可以删除
	 * @param project
	 * @param userDetail
	 * @return
	 */
	public boolean isProjectDeleteable(Project project, UserDetail userDetail);
	
	/**
	 * 项目报表
	 * @param projectReportQueryDto
	 * @return
	 */
	public List<ProjectReport> getProjectReport(ProjectReportQueryDto projectReportQueryDto);

	/**
	 * 更新项目的实际工时
	 * @param project
	 */
	public boolean updateProjectWorkingTime(Long projectId);

	/**
	 * 加载自己的有效的项目
	 * @param userDetail
	 * @return
	 */
	public List<KeyValueEntity> loadMyProjectsEntity(UserDetail userDetail);

	/**
	 * 加载自己的项目
	 * @param username
	 * @param q
	 * @param pageSize
	 * @param currPage
	 * @return
	 */
	public JSONObject loadMyProjectEntities(String username, String q, Integer pageSize, Integer currPage);

    List<KeyValueEntity> loadPlansEntity(Integer projectId);
}
